from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from config import Config
from flask_wtf.csrf import CSRFProtect

db = SQLAlchemy()
csrf = CSRFProtect()

def create_app(config_name):
    app = Flask(__name__)

    app.config.from_object(Config)
    db.init_app(app)
    csrf.init_app(app)

    from .wrong import wrong
    from .correct import correct
    app.register_blueprint(wrong, url_prefix="")
    app.register_blueprint(correct, url_prefix="")

    return app
